//
//  Address.swift
//  ShopIOS
//
//  Created by Apple on 2019/7/19.
//  Copyright © 2019 Apple. All rights reserved.
//

import Foundation
import SwiftyJSON
struct AddressList {
    var list=[Province]()
    init(json:JSON) {
        list=json.arrayValue.compactMap({Province(json: $0)})
    }
}
struct Province {
    var ShortName: String?
    var Sub = [City]()
    var Name: String?
    var Id: Int = 0
    
    init(json: JSON) {
        ShortName = json["ShortName"].stringValue
        Sub = json["Sub"].arrayValue.compactMap({ City(json: $0)})
        Name = json["Name"].stringValue
        Id = json["Id"].intValue
    }
}
struct City {
    var ShortName: String?
    var Sub = [Area]()
    var Name: String?
    var Id: Int = 0
    
    init(json: JSON) {
        ShortName = json["ShortName"].stringValue
        Sub = json["Sub"].arrayValue.compactMap({ Area(json: $0)})
        Name = json["Name"].stringValue
        Id = json["Id"].intValue
    }
}
struct Area {
    var ShortName: String?
    var Sub = [Street]()
    var Name: String?
    var Id: Int = 0
    
    init(json: JSON) {
        ShortName = json["ShortName"].stringValue
        Sub = json["Sub"].arrayValue.compactMap({ Street(json: $0)})
        Name = json["Name"].stringValue
        Id = json["Id"].intValue
    }
}

struct StreetList {
    var list=[Street]()
    init(json:JSON) {
        list=json.arrayValue.compactMap({Street(json: $0)})
    }
}

struct Street {
    var Name: String?
    var Id: Int = 0
    var ShortName: String?
    var Level: Int = 0
    
    init(json: JSON) {
        Name = json["Name"].stringValue
        Id = json["Id"].intValue
        ShortName = json["ShortName"].stringValue
        Level = json["Level"].intValue
    }
}
